package fr.babos.test.bootstrap 
{
	import com.greensock.easing.Back;
	import com.greensock.TweenMax;
	import fr.babos.core.log.Log;
	import fr.babos.core.mvc.View;
	import org.osflash.signals.events.GenericEvent;
	
	/**
	 * @author ZoulouX
	 */
	public class View2Test extends View 
	{
		public function View2Test ()
		{
			x = 250;
			y = 150;
			
			graphics.beginFill(0x00FF00);
			graphics.drawRect(-50, -50, 100, 100);
		}
		
		override public function turnOn ():void
		{
			Log.log("View2Test.turnOn");
			dispatchEngineSignal(onTurningOn);
			
			TweenMax.from(this, 1, {
				scaleX: 0,
				scaleY: 0,
				alpha: 0,
				ease: Back.easeOut,
				onComplete: dispatchEngineSignal,
				onCompleteParams: [_onTurnedOn]
			});
		}
		
		override public function turnOff ():void
		{
			Log.log("View2Test.turnOff");
			dispatchEngineSignal(onTurningOff);
			
			TweenMax.to(this, 1, {
				scaleX: 0,
				scaleY: 0,
				alpha: 0,
				ease: Back.easeIn,
				onComplete: dispatchEngineSignal,
				onCompleteParams: [_onTurnedOff]
			});
		}
		
		override public function dispose ():void
		{
			Log.log("View2Test.dispose");
			super.dispose();
		}
	}
}